home *** CD-ROM | disk | FTP | other *** search
/ SGI Enlighten DSM 1.1 / SGI EnlightenDSM 1.1.iso / hp10x / emd.z / emd / bin / enl_post_install < prev    next >
Text File  |  1998-06-30  |  24KB  |  985 lines

  1. #!/bin/sh 
  2. #
  3. #  Post-install script for the Enlighten 2.0 products
  4. #
  5. #  usage: enl_post_install [-norc] [-nostart] \
  6. #             [-trap <host>] [-community <name>]
  7. #             [-informix <DB_path>] [-emdir <emd_dir>] [-emdhost <host>] \
  8. #             [-pephost <host>] [-enlighten <path>] [-installhost <host>] \
  9. #             [-installhostip <second try host for e_validate> \
  10. #             [-allowedhosts <hosts> ] [<component> ...]
  11. #
  12. #           <component> ::= events
  13. #                       ::= admin
  14. #                       ::= pep
  15. #                       ::= emd
  16. #                       ::= renld
  17. #
  18. # Copyright (c) 1990-1998 Enlighten Software Solutions, Inc.
  19. # All rights reserved.
  20. #
  21.  
  22. umask 077
  23.  
  24. exit_door() {
  25. #
  26. # The install gui is keyed to look for the string
  27. # "Configuration was successful." or "Configuration failed."
  28. # to determine the script's completion. Don't change these strings
  29. # without changing install/gui/nodeDist.c's EXIT_TOKEN strings.
  30. #
  31.  
  32.     if [ "$error" -eq 1 ] ; then
  33.         echo "Configuration failed." 1>&2
  34.         echo "Configuration failed."
  35.     else
  36.         echo "Configuration was successful." 1>&2
  37.         echo "Configuration was successful."
  38.     fi
  39.  
  40.     exit $error
  41. }
  42.  
  43. error_check () {
  44.     if [ $? -ne 0 ] ; then
  45.         echo "$appName: Fatal: Could not successfully finish configuring Enliughten" >> $LOG
  46.         error=1
  47.         exit_door
  48.     fi
  49. }
  50.  
  51.  
  52. PATH=/bin:/usr/bin:/etc:/usr/ucb:/usr/bsd:/usr/etc:$PATH ; export PATH
  53.  
  54. # Global constants for easy modification 
  55.  
  56. KEY_FILE="/etc/enlighten" 
  57.  
  58. appName=`basename $0`
  59. localhost=`uname -n`
  60. postinstall_agent="postinstall_agent" 
  61. postinstall_sysadm="postinstall_sysadm" 
  62. postinstall_emd="postinstall_emd" 
  63. start_enl_daemons="start_enl_daemons" 
  64. e_putrc="e_putrc" 
  65. e_validate="e_validate" 
  66.  
  67. renld_prog="renld"
  68. agent_prog="AgentMon"
  69. allow_hosts=""
  70.  
  71. pep_prog="pep"
  72. pep_rules="contrib/rules.txt"
  73. pephost=""
  74.  
  75. emdhost=""
  76. db_path=""
  77. dbenl=""
  78.  
  79. community="public"
  80. trap_host=`uname -n`
  81.  
  82. TMPFILE="/tmp/enlinstall.$$"
  83. PEP_SLEEP_TIME=25
  84.  
  85. install_host=""
  86. install_host_ip=""
  87.  
  88. flexdaemon="lmgrd"
  89. flexlog="lmgrd.log"
  90. dsmld="dsmld"
  91. licfile="license.dat"
  92.  
  93. # Run-time flags
  94.  
  95. start_at_boot=1
  96. start_daemons_now=1
  97. do_all=1
  98.  
  99. verbs=0
  100. do_events=0
  101. do_events_upgrade=0
  102. do_admin=0
  103. do_admin_upgrade=0
  104. do_emd=0
  105. do_emd_upgrade=0
  106. do_renld=0
  107. do_renld_upgrade=0
  108. do_pep=0
  109. do_pep_upgrade=0
  110. do_lic=0
  111. do_lic_upgrade=0
  112.  
  113.  
  114.  
  115.  
  116. # check command line arguments 
  117.  
  118.  
  119. if [ "$#" -lt 1 ] ; then
  120.     echo 
  121.     echo "Usage: $appName [-norc] [-nostart] "
  122.     echo "          [-trap <host>] [-community <name>] "
  123.     echo "          [-informix <path>] [ -emdir <emd_dir>] "
  124.     echo "          [-enlighten <enlighten_path>] [-allowedhosts  <hosts>]"
  125.     echo "          [-pephost <host>] [-emdhost <host>] [-enlighten <path>]"
  126.     echo "          [-dbhome <path>] [-installhost <host>] [<component upgrade_flag> ...]"
  127.     echo 
  128.     echo "  <component> ::= events admin renld pep emd lic"
  129.     echo "  upgrade_flag 0 to install, 1 to upgrade"
  130.     echo 
  131.     exit 1
  132. fi
  133.  
  134. error=0
  135.  
  136. while [ $# -ne 0 ] ; do
  137.     case "$1" in
  138.         events )
  139.             do_events=1
  140.             do_all=0
  141.             do_events_upgrade=$2
  142.             shift 
  143.             ;;
  144.         admin )
  145.             do_admin=1
  146.             do_all=0
  147.             do_admin_upgrade=$2
  148.             shift 
  149.             ;;
  150.         renld )
  151.             do_renld=1
  152.             do_all=0
  153.             do_renld_upgrade=$2
  154.             shift 
  155.             ;;
  156.         pep )
  157.             do_pep=1
  158.             do_all=0
  159.             pephost=`uname -n`
  160.             do_pep_upgrade=$2
  161.             shift 
  162.             ;;
  163.         emd )
  164.             do_emd=1
  165.             do_all=0
  166.                 if test -z "$emdhost" ; then
  167.                 emdhost=`uname -n`
  168.             fi
  169.             do_emd_upgrade=$2
  170.             shift 
  171.             ;;
  172.         lic )
  173.             do_lic=1
  174.             do_all=0
  175.             do_lic_upgrade=$2
  176.             shift 
  177.             ;;
  178.         -norc )
  179.             start_at_boot=0
  180.             ;;
  181.         -nostart )
  182.             start_daemons_now=0
  183.             ;;
  184.         -trap )
  185.             trap_host=$2
  186.             shift 
  187.             ;;
  188.         -community )
  189.             community=$2
  190.             shift 
  191.             ;;
  192.         -enlighten )
  193.             ENLIGHTEN=$2
  194.             shift 
  195.             ;;
  196.         -emdhost )
  197.             emdhost=$2
  198.             shift 
  199.             ;;
  200.         -pephost )
  201.             pephost=$2
  202.             shift 
  203.             ;;
  204.         -allowedhosts )
  205.             allow_hosts=$2
  206.             shift 
  207.             ;;
  208.         -informix )
  209.             db_path=$2
  210.             shift 
  211.             ;;
  212.         -dbhome )
  213.             dbenl=$2
  214.             shift 
  215.             ;;
  216.         -emdir )
  217.             emd_dir=$2
  218.             shift 
  219.             ;;
  220.         -installhost )
  221.             install_host=$2
  222.             shift 
  223.             ;;
  224.         -installhostip )
  225.             install_host_ip=$2
  226.             shift 
  227.             ;;
  228.         * )
  229.             echo $appName": Invalid component name: $1"
  230.             ;;
  231.     esac    
  232.     shift 
  233. done
  234.  
  235. # export shell variables
  236.  
  237. export ENLIGHTEN emd_dir KEY_FILE 
  238.  
  239.  
  240. if [ -n "$ENLIGHTEN" ] ; then
  241.     execdir=${ENLIGHTEN}/bin
  242.     if [ ! -d "${ENLIGHTEN}/logs" ] ; then
  243.         mkdir -p ${ENLIGHTEN}/logs
  244.         if [ $? -ne 0 ] ; then
  245.             echo "$appName: Fatal: Could not mkdir $ENLIGHTEN/logs." 1>&2
  246.             exit 1
  247.         fi
  248.     fi
  249. else
  250.     if [ -n "$emd_dir" ] ; then
  251.         execdir=${emd_dir}/bin
  252.         if [ ! -d "${emd_dir}/logs" ] ; then
  253.             mkdir -p ${emd_dir}/logs
  254.             if [ "$?" -ne 0 ] ; then
  255.                 echo "$appName: Fatal: Could not mkdir $emd_dir/logs." 1>&2
  256.                 exit 1
  257.             else
  258.                 chmod 700 ${emd_dir}/logs
  259.             fi
  260.         fi
  261.     fi
  262. fi
  263.  
  264. if [ -z "$execdir" -o ! -d "$execdir" ] ; then
  265.     echo "$appName: Fatal: 'enlighten' and 'emd_dir' was not found." 1>&2
  266.     exit 1
  267. fi
  268.  
  269. if [ "$verbs" -eq 1 ]; then
  270.     echo "execdir is: $execdir"
  271. fi
  272.  
  273. # ----------------------------------------------------------------------------
  274. # Update the /etc/enlighten file
  275. # ----------------------------------------------------------------------------
  276.  
  277. if [ ! -f "$KEY_FILE" ] ; then
  278.     echo "#"                                                                             > $KEY_FILE
  279.     echo "# File: $KEY_FILE"                                                             >> $KEY_FILE
  280.     echo "#"                                                                             >> $KEY_FILE
  281.     echo "# This file is used by all Enlighten components as a common repository"        >> $KEY_FILE
  282.     echo "# for the root Enlighten directory, the hostnames of the PEP and EMD servers," >> $KEY_FILE
  283.     echo "# and the installation host (used for automatic license administration)."      >> $KEY_FILE
  284.     echo "#"                                                                             >> $KEY_FILE
  285.     echo "# Note that editting this file has the potential to corrupt the local"         >> $KEY_FILE
  286.     echo "# installation of Enlighten."                                                  >> $KEY_FILE
  287.     echo "#"                                                                             >> $KEY_FILE
  288.     echo "# Copyright (c) 1990-1998 Enlighten Software Solutions, Inc."                                 >> $KEY_FILE
  289.     echo "# All Rights Reserved"                                                         >> $KEY_FILE
  290.     echo "#"                                                                             >> $KEY_FILE
  291.     echo " "                                                                             >> $KEY_FILE
  292. else
  293.     #
  294.     # Remove any tokens from /etc/enlighten that will be rewritten.
  295.     #
  296.  
  297.     cp $KEY_FILE ${KEY_FILE}.old
  298.  
  299.     if [ -n "$ENLIGHTEN" ] ; then
  300.         egrep -v "^enlighten=" $KEY_FILE > ${KEY_FILE}.tmp
  301.         mv ${KEY_FILE}.tmp $KEY_FILE
  302.     fi
  303.  
  304.     if [ -n "$install_host" ] ; then
  305.         egrep -v "^install_host=" $KEY_FILE > ${KEY_FILE}.tmp
  306.         mv ${KEY_FILE}.tmp $KEY_FILE
  307.     fi
  308.  
  309.     if [ -n "$install_host_ip" ] ; then
  310.         egrep -v "^install_host_ip=" $KEY_FILE > ${KEY_FILE}.tmp
  311.         mv ${KEY_FILE}.tmp $KEY_FILE
  312.     fi
  313.  
  314.     if [ -n "$emdhost" ] ; then
  315.         egrep -v "^emd_host=" $KEY_FILE > ${KEY_FILE}.tmp
  316.         mv ${KEY_FILE}.tmp $KEY_FILE
  317.     fi
  318.  
  319.     if [ -n "$emd_dir" ] ; then
  320.         egrep -v "^emd_dir=" $KEY_FILE > ${KEY_FILE}.tmp
  321.         mv ${KEY_FILE}.tmp $KEY_FILE
  322.     fi
  323.  
  324.     if [ -n "$pephost" ] ; then
  325.         egrep -v "^pep_host=" $KEY_FILE > ${KEY_FILE}.tmp
  326.         mv ${KEY_FILE}.tmp $KEY_FILE
  327.     fi
  328. fi
  329.  
  330. #
  331. # Insert the tokens
  332. #
  333.  
  334. if [ -n "$ENLIGHTEN" ] ; then
  335.     echo "enlighten=$ENLIGHTEN" >> $KEY_FILE
  336. fi
  337.  
  338. if [ -n "$install_host" ] ; then
  339.     echo "install_host=$install_host" >> $KEY_FILE
  340. fi
  341.  
  342. if [ -n "$install_host_ip" ] ; then
  343.     echo "install_host_ip=$install_host_ip" >> $KEY_FILE
  344. fi
  345.  
  346. if [ -n "$emdhost" ] ; then
  347.     echo "emd_host=$emdhost" >> $KEY_FILE
  348. fi
  349.  
  350. if [ -n "$emd_dir" ] ; then
  351.     echo "emd_dir=$emd_dir" >> $KEY_FILE
  352. fi
  353.  
  354. if [ -n "$pephost" ] ; then
  355.     echo "pep_host=$pephost" >> $KEY_FILE
  356. fi
  357.  
  358. # Override the umask of root
  359.  
  360. chown root $KEY_FILE
  361. chmod 444 $KEY_FILE
  362.  
  363. # ----------------------------------------------------------------------------
  364. #   Make the .data and log and patches directories
  365. # ----------------------------------------------------------------------------
  366.  
  367.  
  368. LOG="${execdir}/../logs/config.log"
  369.  
  370. if [ -n "$ENLIGHTEN" ] ; then
  371.     if [ ! -d "${ENLIGHTEN}/.data" ] ; then
  372.         mkdir -p ${ENLIGHTEN}/.data
  373.         if [ "$?" -ne 0 ] ; then
  374.             echo "$appName: Fatal: mkdir ${ENLIGHTEN}/.data failed." 1>&2
  375.             error=1
  376.         fi
  377.     fi
  378.  
  379.     if [ ! -d "${ENLIGHTEN}/patches" ] ; then
  380.         mkdir -p ${ENLIGHTEN}/patches
  381.         if [ "$?" -ne 0 ] ; then
  382.             echo "$appName: Fatal: mkdir ${ENLIGHTEN}/patches failed." 1>&2
  383.             error=1
  384.         fi
  385.     fi
  386.  
  387.     if [ ! -d "${ENLIGHTEN}/logs" ] ; then
  388.         mkdir -p ${ENLIGHTEN}/logs
  389.         if [ "$?" -ne 0 ] ; then
  390.             echo "$appName: Fatal: mkdir ${ENLIGHTEN}/logs failed." 1>&2
  391.             error=1
  392.         fi
  393.     fi
  394.     # Deal with SCO 32 tar bug
  395.  
  396.     if [ -d "${ENLIGHTEN}/msg/C" ] ; then
  397.         chmod 700 ${ENLIGHTEN}/msg/C
  398.         chmod 400 ${ENLIGHTEN}/msg/C/*.mcat
  399.     fi
  400.  
  401. fi
  402.  
  403. echo "$appName: Starting configuration on `date`" >> $LOG
  404.  
  405. #-----------------------------------------------------------------------------
  406. #            Create the group enldsm
  407. #----------------------------------------------------------------------------
  408.  
  409. ypcat_group_output=/tmp/$appName.yg
  410. niscat_group_output=/tmp/$appName.ng
  411. enldsm_gid=1000 ; export enldsm_gid
  412. ETCGROUP=/etc/group
  413. os_name=`uname -s`
  414. os_release=`uname -r`
  415. temp_file=/tmp/$appName.$$
  416.  
  417. # Determine what ps options to use.
  418. # All systems use "-e" expcept for
  419. # SunOS 4.1.3 and 4.1.4 that use -auxww
  420.  
  421. ps_opts="-e"
  422. if [ "$os_name" = "SunOS" ] ; then
  423.     case "$os_release" in
  424.         4.1.* )
  425.             ps_opts="-auxww" ;;
  426.         * ) ;;
  427.     esac
  428. fi
  429.  
  430.  
  431.  
  432. # Determine if NIS or NIS+ is running
  433.  
  434. unset nis_running
  435.  
  436. if [ -n "`ps $ps_opts | grep ypbind | grep -v grep`" ] ; then
  437.  
  438.     # Ensure NIS is actually up and functional
  439.  
  440.     ypcat group 2> /dev/null > $ypcat_group_output
  441.     if [ $? -ne 0 ] ; then
  442.         echo "$appName: Host was found to be running ypbind, but 'ypcat group' failed."  >> $LOG
  443.     else
  444.         nis_running="true"
  445.     fi
  446. fi
  447.  
  448. if [ -n "`ps $ps_opts | grep nis_cach | grep -v grep`" ] ; then
  449.  
  450.     # Ensure NIS+ is actually up and functional
  451.  
  452.     niscat group.org_dir 2> /dev/null > $niscat_group_output
  453.     if [ $? -ne 0 ] ; then
  454.         echo "$appName: The NIS+ client daemon was up, but 'niscat group.org_dir' failed."  >> $LOG
  455.     else
  456.         nis_plus_running="true"
  457.     fi
  458. fi
  459.  
  460. force_local_enldsm_group="true"
  461.  
  462. # See if group 'enldsm' is defined
  463.  
  464. unset enldsm_group_exists
  465.  
  466. if [ -n "`grep '^enldsm:' $ETCGROUP`" ] ; then
  467.     enldsm_group_exists="true"
  468.     enldsm_gid=`grep "^enldsm:" $ETCGROUP | cut '-d:' -f3`
  469. elif [ -z "$force_local_enldsm_group" -a "$nis_running" ] ; then
  470.     if [ -n "`grep '^enldsm:' $ypcat_group_output`" ] ; then
  471.         enldsm_group_exists="true"
  472.         enldsm_gid=`grep "^enldsm:" $ypcat_group_output | cut '-d:' -f3`
  473.     fi
  474. elif [ -z "$force_local_enldsm_group" -a "$nis_plus_running" ] ; then
  475.     if [ -n "`grep '^enldsm:' $niscat_group_output`" ] ; then
  476.         enldsm_group_exists="true"
  477.         enldsm_gid=`grep "^enldsm:" $niscat_group_output | cut '-d:' -f3`
  478.     fi
  479. fi
  480.  
  481. # Create the 'enldsm' group if necessary
  482.  
  483. if [ ! "$enldsm_group_exists" ] ; then
  484.  
  485.     # Make a temporary file with all the current gid #s
  486.     # (using a temp file lets me only call ypcat or niscat once.)
  487.  
  488.     cut '-d:' -f3 $ETCGROUP > $temp_file
  489.     error_check
  490.     if [ "$nis_running" ] ; then
  491.         cat $ypcat_group_output | cut '-d:' -f3 >> $temp_file
  492.         error_check
  493.     fi
  494.     if [ "$nis_plus_running" ] ; then
  495.         cat $niscat_group_output | cut '-d:' -f3 >> $temp_file
  496.         error_check
  497.     fi
  498.  
  499.     # Now search through that file to find a unique id.
  500.  
  501.     while [ -n "`fgrep -x $enldsm_gid $temp_file`" ] ; do
  502.         if [ "$verbose_output" ] ; then
  503.             echo "$appName: 'enldsm' gid $enldsm_gid was not unique."  >> $LOG
  504.         fi
  505.         enldsm_gid=`expr 1 + $enldsm_gid`
  506.     done
  507.  
  508.     # Backup $ETCGROUP
  509.  
  510.     cp $ETCGROUP $ETCGROUP.orig
  511.     echo "$appName: $ETCGROUP was archived to $ETCGROUP.orig"  >> $LOG
  512.  
  513.     # And add the entry to the start of $ETCGROUP
  514.  
  515.     rm -f $temp_file
  516.     error_check
  517.  
  518.     lineno=`grep -n "^+" $ETCGROUP | awk -F: '{print $1}'` 
  519.      
  520.     if [ $lineno ] ; then
  521.         sed -e ''${lineno}'i\
  522. enldsm::'${enldsm_gid}':' $ETCGROUP > $temp_file
  523.         error_check
  524.     else
  525.         cat $ETCGROUP > $temp_file
  526.         error_check
  527.         echo 'enldsm::'${enldsm_gid}':' >> $temp_file
  528.         error_check
  529.     fi
  530.  
  531.     cp $temp_file $ETCGROUP
  532.     error_check
  533.  
  534.     chmod 644 $ETCGROUP
  535.     error_check
  536.     rm -f $temp_file
  537.     error_check
  538.  
  539.     echo "$appName: Group 'enldsm' (gid=$enldsm_gid) was added successfully."  >> $LOG
  540. fi
  541.  
  542. # ----------------------------------------------------------------------------
  543. #     Do EMD Post-installation 
  544. # ----------------------------------------------------------------------------
  545.  
  546. if [ "$do_emd" -eq 1 -o "$do_all" -eq 1 ] ; then
  547.  
  548.     echo "$appName: Post-installing EMD...." >> $LOG
  549.  
  550.     if [ -n "$emd_dir" ] ; then
  551.         if [ ! -d "${emd_dir}/patches" ] ; then
  552.             mkdir -p ${emd_dir}/patches
  553.         fi
  554.     fi
  555.  
  556.     if [ "$db_path" != "" ] ; then
  557.         infmx_path="-f $db_path"
  558.     else
  559.         infmx_path=""
  560.     fi
  561.  
  562.     if [ "$emd_dir" != "" ] ; then
  563.         emdir="-emdir $emd_dir"
  564.     else
  565.         emdir=""
  566.     fi
  567.     
  568.     if [ "$dbenl" != "" ] ; then
  569.         dbhome="-dbhome $dbenl"
  570.     else
  571.         dbhome=""
  572.     fi
  573.  
  574.     upgrade_flag="-upgrade $do_emd_upgrade"
  575.  
  576.     if [ -x "${emd_dir}/bin/${postinstall_emd}" ] ; then
  577.         ${emd_dir}/bin/${postinstall_emd} $infmx_path $emdir $dbhome $upgrade_flag >> $LOG
  578.         if [ "$?" -ne 0 ] ; then
  579.             error=1
  580.         fi
  581.     else
  582.         if [ -x "${execdir}/${postinstall_emd}" ] ; then
  583.             ${execdir}/${postinstall_emd} $infmx_path $emdir $dbhome  $upgrade_flag >> $LOG
  584.             if [ "$?" -ne 0 ] ; then
  585.                 error=1
  586.             fi
  587.         else
  588.             echo "$appName: Fatal: $postinstall_emd is missing." 1>&2
  589.             error=1
  590.         fi
  591.     fi
  592.  
  593.     #
  594.     # part of emd post installation is to do the licensing postinstall.
  595.     #
  596.  
  597.     flexdir="${emd_dir}/FLEXlm"
  598.  
  599.     chown dbenl ${flexdir}/*
  600.     if [ "$?" -ne 0 ] ; then
  601.         error=1
  602.     fi
  603.  
  604.     # remove old links and create new ones 
  605.  
  606.     if [ -f "${flexdir}/lmdown" ] ; then
  607.         rm ${flexdir}/lmdown
  608.     fi
  609.     if [ -f "${flexdir}/lmcksum" ] ; then
  610.         rm ${flexdir}/lmcksum
  611.     fi
  612.     if [ -f "${flexdir}/lmdiag" ] ; then
  613.         rm ${flexdir}/lmdiag
  614.     fi
  615.     if [ -f "${flexdir}/lmhostid" ] ; then
  616.         rm ${flexdir}/lmhostid
  617.     fi
  618.     if [ -f "${flexdir}/lminstall" ] ; then
  619.         rm ${flexdir}/lminstall
  620.     fi
  621.     if [ -f "${flexdir}/lmremove" ] ; then
  622.         rm ${flexdir}/lmremove
  623.     fi
  624.     if [ -f "${flexdir}/lmreread" ] ; then
  625.         rm ${flexdir}/lmreread
  626.     fi
  627.     if [ -f "${flexdir}/lmswitchr" ] ; then
  628.         rm ${flexdir}/lmswitchr
  629.     fi
  630.     if [ -f "${flexdir}/lmstat" ] ; then
  631.         rm ${flexdir}/lmstat
  632.     fi
  633.  
  634.     ln ${flexdir}/lmutil ${flexdir}/lmdown    
  635.     ln ${flexdir}/lmutil ${flexdir}/lmcksum    
  636.     ln ${flexdir}/lmutil ${flexdir}/lmdiag    
  637.     ln ${flexdir}/lmutil ${flexdir}/lmhostid    
  638.     ln ${flexdir}/lmutil ${flexdir}/lminstall    
  639.     ln ${flexdir}/lmutil ${flexdir}/lmremove    
  640.     ln ${flexdir}/lmutil ${flexdir}/lmreread    
  641.     ln ${flexdir}/lmutil ${flexdir}/lmswitchr    
  642.     ln ${flexdir}/lmutil ${flexdir}/lmstat    
  643.  
  644.     # we can't start the daemon if this exists
  645.     # and is owned by somebody else
  646.     rm -f /usr/tmp/lockdsmld > /dev/null 2>&1
  647.  
  648.     # Start the license daemons      
  649.  
  650.     su dbenl -c "${flexdir}/start_dsmld"   
  651.     if [ "$?" -eq 1 ] ; then
  652.         error=1
  653.     fi
  654. fi
  655.  
  656. if [ "$error" -eq 1 ] ; then
  657.      exit_door
  658. fi
  659.  
  660. #----------------------------------------------------------------------------
  661. #        Do license file post_install
  662. #---------------------------------------------------------------------------
  663. #
  664. # If we not installin/upgrading the emd portion but have got a new license 
  665. # file to work with, we must tell the dsmld to reread the file.
  666. # If the emd was installed, the license daemons would alreadsy have been
  667. # handles in the code above, so do nothing.
  668.  
  669. if [ "$do_emd" -eq 0 -a "$do_lic" -eq 1 ] ; then
  670.     
  671.     flexdir=${emd_dir}/FLEXlm
  672.     chown dbenl ${emd_dir}/FLEXlm/${licfile}
  673.  
  674.     # don't do anything if license daemons aren't installed
  675.  
  676.     if [ -f ${flexdir}/lmgrd -a -f ${flexdir}/dsmld -a -f ${flexdir}/start_dsmld -a ${flexdir}/lmutil ] ; then
  677.         su dbenl -c "${flexdir}/start_dsmld"  
  678.         if [ "$?" -eq 1 ] ; then
  679.             error=1
  680.         fi
  681.     fi
  682. fi
  683.             
  684. if [ "$error" -eq 1 ] ; then
  685.      exit_door
  686. fi
  687.  
  688.  
  689. # ----------------------------------------------------------------------------
  690. #       Do Events Post-installation 
  691. # ----------------------------------------------------------------------------
  692. if [ "$do_events" -eq 1 -o "$do_all" -eq 1 ] ; then
  693.     
  694.     if [ -d ${ENLIGHTEN}/data ] ; then
  695.         chmod g-s ${ENLIGHTEN}/data
  696.     fi
  697.  
  698.     echo "$appName: Post-installing Events..." >> $LOG
  699.  
  700.     ${execdir}/${postinstall_agent} $trap_host $community $do_events_upgrade >> $LOG
  701.  
  702.     if [ "$?" -ne 0 ] ; then
  703.         error=1
  704.     fi
  705. fi
  706.  
  707. if [ "$error" -eq 1 ] ; then
  708.      exit_door
  709. fi
  710.  
  711.  
  712. # ----------------------------------------------------------------------------
  713. #       Do RENLD and GUI post-installation 
  714. # ----------------------------------------------------------------------------
  715. if [ "$do_renld" -eq 1 -o "$do_all" -eq 1 ] ; then
  716.  
  717.     if [ -d ${ENLIGHTEN}/data ] ; then
  718.         chmod g-s ${ENLIGHTEN}/data
  719.     fi
  720.  
  721.     HOSTS_ALLOW="${ENLIGHTEN}/config/hosts.allow"
  722.     HOSTS_ALLOW_BAK="${ENLIGHTEN}/config/hosts.allow.bak"
  723.  
  724.     echo "$appName: Post-installing renld and GUI...." >> $LOG
  725.  
  726.     if [ "$do_renld_upgrade" -eq 1 ] ;  then
  727.         if [ -f "$HOSTS_ALLOW_BAK" ] ; then
  728.             cp $HOSTS_ALLOW_BAK $HOSTS_ALLOW
  729.             if [ "$?" -ne 0 ] ; then
  730.                 error=1
  731.                 echo "Unable to copy $HOSTS_ALLOW_BAK to $HOSTS_ALLOW" >> $LOG
  732.             fi
  733.         fi 
  734.     else
  735.         if [ "$allow_hosts" != "" ] ; then
  736.             for i in $allow_hosts
  737.             do
  738.                 if [ ! -f "$HOSTS_ALLOW" ] ; then
  739.                     echo $i > $HOSTS_ALLOW
  740.                 else
  741.                     echo $i  >> $HOSTS_ALLOW
  742.                 fi
  743.             done
  744.         fi
  745.     fi
  746. fi
  747.  
  748. if [ "$do_renld" -eq 1 -o "$do_admin" -eq 1 -o "$do_all" -eq 1 ] ; then
  749.  
  750.     ${execdir}/${postinstall_sysadm} $do_admin_upgrade >> $LOG
  751.  
  752.     if [ "$?" -ne 0 ] ; then
  753.         error=1
  754.     fi
  755. fi
  756.  
  757. if [ "$error" -eq 1 ] ; then
  758.      exit_door
  759. fi
  760. #-----------------------------------------------------------------------------
  761. #        Do PEP postinstall
  762. #-----------------------------------------------------------------------------
  763.  
  764. if [ "$do_pep" -eq 1 -a "$do_pep_upgrade" -eq 1 ] ; then
  765.  
  766.     if [ -f "${ENLIGHTEN}/${pep_rules}" ] ; then
  767.         cp ${ENLIGHTEN}/${pep_rules} ${ENLIGHTEN}/contrib/rules.new    
  768.         if [ -f "${ENLIGHTEN}/contrib/rules.bak" ] ; then
  769.             cp ${ENLIGHTEN}/contrib/rules.bak ${ENLIGHTEN}/${pep_rules}
  770.         fi
  771.     fi
  772. fi
  773.  
  774. #----------------------------------------------------------------------------
  775. #        Create the manifest files
  776. #        The files will be sorted after the rc references are added...
  777. #---------------------------------------------------------------------------
  778.  
  779. # Get the install dirs from /etc/enlighten
  780.  
  781. emd_etc=`egrep "^emd_dir=" /etc/enlighten | cut '-d=' -f2-`
  782. enl_etc=`egrep "^enlighten=" /etc/enlighten | cut '-d=' -f2-`
  783.  
  784. if [ "$emd_etc" = "$enl_etc" ] ; then
  785.     same_dir=1
  786. else
  787.     same_dir=0
  788. fi
  789.  
  790. if [ \( "$do_emd" -eq 1 -o "$do_lic" -eq 1 \) -a "$same_dir" -eq 0 ] ; then
  791.     emd_manifest="${emd_dir}/manifest"
  792.  
  793.     echo /etc/enlighten > $emd_manifest
  794.     find $emd_dir -print | egrep -v "emdd.log" >> $emd_manifest 
  795.  
  796. fi
  797.  
  798. if [ "$do_pep" -eq 1 -o "$do_events" -eq 1 -o "$do_admin" -eq 1 -o "$do_renld" -eq 1 ] ; then
  799.     enl_manifest=${ENLIGHTEN}/manifest
  800.  
  801.     # directories with run-time files we want to omit
  802.     formlet="config/formlet"
  803.     usert="config/user-templates"
  804.     usera="config/userauth"
  805.     backup="config/backup"
  806.     defpool="config/defaultpool"
  807.     overrides="config/overrides"
  808.     rfd="config/rfd"
  809.     wxy="config/wxy"
  810.     dotdata=".data"
  811.     data="data"
  812.     logs="logs"
  813.     lpr="lpr"
  814.     secure="secure"
  815.     tmp="tmp"
  816.     work="work"
  817.  
  818.     # run-time files we want to eliminate
  819.     testtab="config/testtab"
  820.     enlcmd="config/enlcmd.log"
  821.  
  822.     # installed files/directories we want to add back to manifest because 
  823.     # the directory had many run-time files so we omitted the entire directory
  824.     hidden=".data/.enlighten"
  825.     createdb="logs/createdb.log"
  826.     icon1="icons/C/secure_cls"
  827.     icon2="icons/C/secure_dtop"
  828.     icon3="icons/C/secure_icon"
  829.     icon4="icons/C/network_cls"
  830.     icon5="icons/C/network_dtop"
  831.     icon6="icons/C/network_icon"
  832.     backup1="config/backup/8mm"
  833.     backup2="config/backup/cart"
  834.     backup3="config/backup/jobs"
  835.     backup4="config/backup/log"
  836.     backup5="config/backup/logfiles"
  837.     backup6="config/backup/raw"
  838.     backup7="config/backup/reel"
  839.     backup8="config/backup/regular"
  840.     backup9="config/backup/table"
  841.     rfd1="config/rfd/jobs"
  842.     rfd2="config/rfd/logfiles"
  843.  
  844.     # omit files in small chunks to that egrep on SunOs can handle it
  845.     omit1="$formlet|$usert|$usera"
  846.     omit2="$backup|$defpool|$overrides"
  847.     omit3="$rfd|$wxy|$testtab"
  848.     omit4="$enlcmd|$dotdata|$data"
  849.     omit5="$logs|$lpr|$secure|$tmp|$work"
  850.  
  851.     append="$formlet $usert $usera $backup $defpool $overrides $rfd $wxy $dotdata $data $logs $lpr $secure $tmp $work"
  852.  
  853.     append2="$backup1 $backup2 $backup3 $backup4 $backup5 $backup6 $backup7 $backup8 $backup9 $rfd1 $rfd2"
  854.  
  855.     append_files="$hidden $icon1 $icon2 $icon3 $icon4 $icon5 $icon6"
  856.  
  857.  
  858.     # now we're ready to populate the file...
  859.     echo /etc/enlighten > $enl_manifest
  860.     find $ENLIGHTEN -print | egrep -v "$omit1" | egrep -v "$omit2" | egrep -v "$omit3" | egrep -v "$omit4" | egrep -v "$omit5" >> $enl_manifest    
  861.  
  862.     # add back in installed directories/files that were omitted
  863.     for i in $append
  864.     do
  865.         if [ -d ${ENLIGHTEN}/$i ] ; then
  866.             echo ${ENLIGHTEN}/$i >> $enl_manifest
  867.         fi
  868.     done
  869.  
  870.     for i in $append2
  871.     do
  872.         if [ -d ${ENLIGHTEN}/$i ] ; then
  873.             echo ${ENLIGHTEN}/$i >> $enl_manifest
  874.         fi
  875.     done
  876.  
  877.     for i in $append_files
  878.     do
  879.         if [ -f ${ENLIGHTEN}/$i ] ; then
  880.             echo ${ENLIGHTEN}/$i >> $enl_manifest
  881.         fi
  882.     done
  883.  
  884.     if [ -f ${ENLIGHTEN}/data/install.db ] ; then
  885.         echo ${ENLIGHTEN}/data/install.db >> $enl_manifest
  886.     fi
  887.  
  888.     if [ "$same_dir" -eq 1 ] ; then
  889.         echo ${ENLIGHTEN}/${createdb} >> $enl_manifest
  890.     fi
  891. fi    
  892.     
  893.  
  894. # ----------------------------------------------------------------------------
  895. #        Install the rc reference 
  896. # ----------------------------------------------------------------------------
  897.  
  898. #
  899. # Because e_putrc will be referencing start_enl_daemons, make sure that
  900. # file exists before installing the rc file.
  901. #
  902.  
  903. if [ ! -x "${execdir}/${start_enl_daemons}" ] ; then
  904.     echo "$appName: Fatal: $execdir/$start_enl_daemons is missing." 1>&2
  905.     error=1
  906. fi
  907.  
  908. if [ "$error" -eq 1 ] ; then
  909.      exit_door
  910. fi
  911.  
  912. if [ "$start_at_boot" -eq 1 ] ; then
  913.     if [ -x "${execdir}/${e_putrc}" ] ; then
  914.         ${execdir}/${e_putrc} >> $LOG
  915.         if [ "$?" -ne 0 ] ; then
  916.             error=1
  917.         fi
  918.     else
  919.         echo "$appName: Fatal: $execdir/$e_putrc is missing." 1>&2
  920.         error=1
  921.     fi
  922. fi
  923.  
  924. if [ "$error" -eq 1 ] ; then
  925.      exit_door
  926. fi
  927.  
  928. #-----------------------------------------------------------------------------
  929. #                 sort the manifest files now that rc refernces added in
  930. #----------------------------------------------------------------------------
  931.  
  932. if [ -n "$emd_manifest" ] ; then
  933.     tmp_sort=${emd_dir}/manifest.tmp
  934.     sort $emd_manifest > $tmp_sort
  935.     mv $tmp_sort $emd_manifest
  936. fi     
  937.  
  938. if [ -n "$enl_manifest" ] ; then
  939.     tmp_sort=${emd_dir}/manifest.tmp
  940.     sort $enl_manifest > $tmp_sort
  941.     mv $tmp_sort $enl_manifest
  942. fi     
  943.  
  944.  
  945. #--------------------------------------------------------------------------
  946. #                 Make sure all installed files in group enldsm
  947. #-------------------------------------------------------------------------
  948.  
  949. if [ "$do_emd" -eq 1 ] ; then
  950.     for i in bin patches logs FLEXlm man manifest msg odbc
  951.     do
  952.         chgrp -R enldsm ${emd_dir}/$i
  953.     done
  954.  
  955.     for i in .create_emd_tables.sh .dbaccess_input.txt .odbc.ini .odbc.ini.orig .profile .profile.orig dbexport.out
  956.     do
  957.         if [ -f ${emd_dir}/$i ] ; then
  958.             chgrp enldsm ${emd_dir}/$i
  959.         fi
  960.     done
  961.  
  962.     chgrp enldsm $emd_dir
  963.     chgrp enldsm ${emd_dir}/dbtables
  964. fi
  965.  
  966. if [ "$do_pep" -eq 1 -o "$do_events" -eq 1 -o "$do_admin" -eq 1 -o "$do_renld" -eq 1 ] ; then
  967.  
  968.     chgrp -R enldsm $ENLIGHTEN
  969. fi
  970.  
  971.  
  972. # ----------------------------------------------------------------------------
  973. #        Start the daemons
  974. # ----------------------------------------------------------------------------
  975.  
  976. if [ "$start_daemons_now" -eq 1 ] ; then
  977.     ${execdir}/${start_enl_daemons} >> $LOG
  978.     if [ "$?" -ne 0 ] ; then
  979.         error=1
  980.     fi
  981. fi
  982.  
  983. exit_door
  984.  
  985.